package ntd.util.modular.data.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import ntd.util.UtilCatch;
import ntd.util.modular.data.entity.DataAcquisitionRule;
import ntd.util.modular.data.mapper.DataAcquisitionRuleMapper;
import ntd.util.modular.data.service.DataAcquisitionRuleService;
import ntd.util.modular.data.util.UtilDataAcquisitionManager;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DataAcquisitionRuleServiceImpl extends ServiceImpl<DataAcquisitionRuleMapper, DataAcquisitionRule> implements DataAcquisitionRuleService {

    @Override
    public void initRule() {
        List<DataAcquisitionRule> dataAcquisitionRuleList = list();
        for (DataAcquisitionRule dataAcquisitionRule : dataAcquisitionRuleList) {
            UtilCatch.tryCatchNoRes(() -> {
                UtilDataAcquisitionManager.handleRule(dataAcquisitionRule);
            });
        }
    }
}
